package com.twb.auth.entity.twbProject;

import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.apache.ibatis.type.JdbcType;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.twb.core.base.entity.BaseEntity;

/**
 * <p>
 * 项目管理
 * </p>
 *
 * @author DSY
 * @since 2018-10-24
 */
@TableName(value = "twb_project")
public class TwbProject extends BaseEntity implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 编号
	 */
	@TableId(value="id",type=IdType.ASSIGN_UUID)
	private String id;

	/**
	 * 项目编码
	 */
	@TableField(value="code",jdbcType = JdbcType.VARCHAR)
	private String code;

	/**
	 * 项目名称
	 */
	@TableField(value="name",jdbcType = JdbcType.VARCHAR)
	private String name;
	/**
	 * 接入ID
	 */
	@TableField(value="app_id",jdbcType = JdbcType.VARCHAR)
	private String appId;
	/**
	 * 接入Token
	 */
	@TableField(value="app_token",jdbcType = JdbcType.VARCHAR)
	private String appToken;
	/**
	 * 接入密钥
	 */
	@TableField(value="app_secret",jdbcType = JdbcType.VARCHAR)
	private String appSecret;
	/**
	 * 项目类型（1，服务端；2，微信小程序；3，手机app；4，网页）
	 */
	@TableField(value="app_type",jdbcType = JdbcType.VARCHAR)
	private String appType;
	/**
	 * IP地址
	 */
	@TableField(value="ip_addr",jdbcType = JdbcType.VARCHAR)
	private String ipAddr;
	/**
	 * 端口号
	 */
	@TableField(value="port_code",jdbcType = JdbcType.VARCHAR)
	private String portCode;
	/**
	 * 域名
	 */
	@TableField(value="web_addr",jdbcType = JdbcType.VARCHAR)
	private String webAddr;
	/**
	 * 接入状态(0,不允许接入;1,允许接入)
	 */
	@TableField(value="status",jdbcType = JdbcType.VARCHAR)
	private String status;
	/**
	 * 顺序号
	 */
	@TableField(value="pro_seq",jdbcType = JdbcType.INTEGER)
	private Integer proSeq;
	/**
	 * 备注
	 */
	@TableField(value="remark",jdbcType = JdbcType.VARCHAR)
	private String remark;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getAppToken() {
		return appToken;
	}

	public void setAppToken(String appToken) {
		this.appToken = appToken;
	}

	public String getAppSecret() {
		return appSecret;
	}

	public void setAppSecret(String appSecret) {
		this.appSecret = appSecret;
	}

	public String getAppType() {
		return appType;
	}

	public void setAppType(String appType) {
		this.appType = appType;
	}

	public String getIpAddr() {
		return ipAddr;
	}

	public void setIpAddr(String ipAddr) {
		this.ipAddr = ipAddr;
	}

	public String getPortCode() {
		return portCode;
	}

	public void setPortCode(String portCode) {
		this.portCode = portCode;
	}

	public String getWebAddr() {
		return webAddr;
	}

	public void setWebAddr(String webAddr) {
		this.webAddr = webAddr;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Integer getProSeq() {
		return proSeq;
	}

	public void setProSeq(Integer proSeq) {
		this.proSeq = proSeq;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	
	/**
	 * @Title sort
	 * @Description	排序
	 * @param projects
	 * @author DSY
	 * @date 2020年12月8日 下午5:50:24
	 */
	public void sort(List<TwbProject> projects) {
		Collections.sort(projects, new Comparator<TwbProject>() {// 排序
			@Override
			public int compare(TwbProject o1, TwbProject o2) {
				if (o1.getProSeq() == null) {
					o1.setProSeq(10000);
				}
				if (o2.getProSeq() == null) {
					o2.setProSeq(10000);
				}
				return o1.getProSeq().compareTo(o2.getProSeq());
			}
		});
	}
}
